{extend name="index/index"}
{block name="content"}
  <fieldset>
    <legend>用户编辑</legend>
    <div class="am-form-group">
      <input type="hidden" name="uid" value="{$row['id']}">
      <label for="doc-vld-name">用户名：</label>
      <input type="text" id="doc-vld-name" class="am-form-field" value="{$row['name']}" required/>
      {volist name="data" id="v"}
        {$v['name']}：<input type="checkbox" name="sid{$v['id']}" value="{$v['id']}" class="do_change"
        {volist name="arr" id="m"}
        {if condition="$m eq $v['id']"}
        checked
        {/if}
        {/volist}>
      {/volist}
    </div>
  </fieldset>

<script>
    $(function(){
        // 删除动作
        $('.do_change').change(function(){
            var powid = $(this).attr('value');
            // console.log(powid);
            $.ajax({
                    type: 'post',
                    url : '/mqwer/'+{$row.id},
                data :{ "sid": powid,"mid": "{$row.id}" },
            dataType: 'json',
                success : function (data){
                console.log(data);
                if (data.status) {
                    toastr.success(data.info);
                    console.log(obj);
                } else {
                    toastr.error(data.info, 'FBI WARING:');
                }
            },
            error:function(){
                alert('AJAX操作失败!');
            }
        });
        });
    });

</script>
{/block}